
 <!DOCTYPE HTML>
<html lang="zh-Hans">
<head>
  <meta charset="UTF-8">
  
    <title>CTF中代码审计小trick(未完) | </title>
    <meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=no">
    
    <meta name="author" content="daiker">
    

    
    <meta name="description" content="0x00 弱类型强类的语言遇到函数引数类型和实际调用类型不匹配的情况经常会直接出错或者编译失败；而弱类型的语言常常会实行隐式转换，或者产生难以意料的结果 也就是说，其实弱类型式其实式语言帮我们做了转换，好处是我们编程的时候可以省很多力，但是方便的同时也带来一些问题。注意的是，python并不是一门弱类型的语言。  string转intphp在将string转化成int的时候会把后面的字母舍掉。比如">
<meta name="keywords" content="ctf,Web,代码审计">
<meta property="og:type" content="article">
<meta property="og:title" content="CTF中代码审计小trick(未完)">
<meta property="og:url" content="http://www.daiker.com.cn/2017/05/04/CTF中代码审计小trick(未完)/index.html">
<meta property="og:site_name">
<meta property="og:description" content="0x00 弱类型强类的语言遇到函数引数类型和实际调用类型不匹配的情况经常会直接出错或者编译失败；而弱类型的语言常常会实行隐式转换，或者产生难以意料的结果 也就是说，其实弱类型式其实式语言帮我们做了转换，好处是我们编程的时候可以省很多力，但是方便的同时也带来一些问题。注意的是，python并不是一门弱类型的语言。  string转intphp在将string转化成int的时候会把后面的字母舍掉。比如">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2018-02-21T04:07:06.593Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="CTF中代码审计小trick(未完)">
<meta name="twitter:description" content="0x00 弱类型强类的语言遇到函数引数类型和实际调用类型不匹配的情况经常会直接出错或者编译失败；而弱类型的语言常常会实行隐式转换，或者产生难以意料的结果 也就是说，其实弱类型式其实式语言帮我们做了转换，好处是我们编程的时候可以省很多力，但是方便的同时也带来一些问题。注意的是，python并不是一门弱类型的语言。  string转intphp在将string转化成int的时候会把后面的字母舍掉。比如">
<meta name="twitter:creator" content="@daikersec">

    
    <link rel="alternative" href="/atom.xml" title="" type="application/atom+xml">
    
    
    <link rel="icon" href="/img/favicon.png">
    
    
    <link rel="apple-touch-icon" href="/img/jacman.jpg">
    <link rel="apple-touch-icon-precomposed" href="/img/jacman.jpg">
    
    <link rel="stylesheet" href="/css/style.css">
</head>

  <body>
    <header>
      
<div>
		
			<div id="imglogo">
				<a href="/"><img src="/img/logo.png" alt="" title=""/></a>
			</div>
			
			<div id="textlogo">
				<h1 class="site-name"><a href="/" title=""></a></h1>
				<h2 class="blog-motto"></h2>
			</div>
			<div class="navbar"><a class="navbutton navmobile" href="#" title="Menu">
			</a></div>
			<nav class="animated">
				<ul>
					<ul>
					 
						<li><a href="/">首页</a></li>
					
						<li><a href="/archives">归档</a></li>
					
						<li><a href="/tags">标签</a></li>
					
						<li><a href="/categories">分类</a></li>
					
					<li>
 					
						<form class="search" action="http://zhannei.baidu.com/cse/search" target="_blank">
							<label>Search</label>
						<input name="s" type="hidden" value= 6197743525332190000 ><input type="text" name="q" size="30" placeholder="Search"><br>
						</form>
					
					</li>
				</ul>
			</nav>			
</div>
    </header>
    <div id="container">
      <div id="main" class="post" itemscope itemprop="blogPost">
  
	<article itemprop="articleBody"> 
		<header class="article-info clearfix">
  <h1 itemprop="name">
    
      <a href="/2017/05/04/CTF中代码审计小trick(未完)/" title="CTF中代码审计小trick(未完)" itemprop="url">CTF中代码审计小trick(未完)</a>
  </h1>
  <p class="article-author">By
       
		<a href="/about" title="daiker" target="_blank" itemprop="author">daiker</a>
		
  <p class="article-time">
    <time datetime="2017-05-04T13:14:14.000Z" itemprop="datePublished"> Published 2017-05-04</time>
    
  </p>
</header>
	<div class="article-content">
		
		<div id="toc" class="toc-article">
			<strong class="toc-title">Contents</strong>
		
			<ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#0x00-弱类型"><span class="toc-number">1.</span> <span class="toc-text"><a href="#0x00-&#x5F31;&#x7C7B;&#x578B;" class="headerlink" title="0x00 &#x5F31;&#x7C7B;&#x578B;"></a>0x00 &#x5F31;&#x7C7B;&#x578B;</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#0x01-strcmp"><span class="toc-number">2.</span> <span class="toc-text"><a href="#0x01-strcmp" class="headerlink" title="0x01 strcmp"></a>0x01 strcmp</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#0x02-array-search-与in-array"><span class="toc-number">3.</span> <span class="toc-text"><a href="#0x02-array-search-&#x4E0E;in-array" class="headerlink" title="0x02 array_search()&#x4E0E;in_array()"></a>0x02 array_search()&#x4E0E;in_array()</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#0x03-md5"><span class="toc-number">4.</span> <span class="toc-text"><a href="#0x03-md5" class="headerlink" title="0x03 md5"></a>0x03 md5</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#0x04-eregi"><span class="toc-number">5.</span> <span class="toc-text"><a href="#0x04-eregi" class="headerlink" title="0x04 eregi"></a>0x04 eregi</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#0x05-file-put-content和unlink"><span class="toc-number">6.</span> <span class="toc-text"><a href="#0x05-file-put-content&#x548C;unlink" class="headerlink" title="0x05 file_put_content&#x548C;unlink"></a>0x05 file_put_content&#x548C;unlink</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#0x06-rand"><span class="toc-number">7.</span> <span class="toc-text"><a href="#0x06-rand" class="headerlink" title="0x06 rand"></a>0x06 rand</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#0x07-end-array-和array-length-array-1"><span class="toc-number">8.</span> <span class="toc-text"><a href="#0x07-end-array-&#x548C;array-length-array-1" class="headerlink" title="0x07 end(array)&#x548C;array[length(array)-1]"></a>0x07 end(array)&#x548C;array[length(array)-1]</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#0x08-未初始化变量漏洞"><span class="toc-number">9.</span> <span class="toc-text"><a href="#0x08-&#x672A;&#x521D;&#x59CB;&#x5316;&#x53D8;&#x91CF;&#x6F0F;&#x6D1E;" class="headerlink" title="0x08 &#x672A;&#x521D;&#x59CB;&#x5316;&#x53D8;&#x91CF;&#x6F0F;&#x6D1E;"></a>0x08 &#x672A;&#x521D;&#x59CB;&#x5316;&#x53D8;&#x91CF;&#x6F0F;&#x6D1E;</span></a></li></ol>
		
		</div>
		
		<h1 id="0x00-弱类型"><a href="#0x00-弱类型" class="headerlink" title="0x00 弱类型"></a>0x00 弱类型</h1><p>强类的语言遇到函数引数类型和实际调用类型不匹配的情况经常会直接出错或者编译失败；而弱类型的语言常常会实行隐式转换，或者产生难以意料的结果</p>
<p>也就是说，其实弱类型式其实式语言帮我们做了转换，好处是我们编程的时候可以省很多力，但是方便的同时也带来一些问题。注意的是，<code>python</code>并不是一门弱类型的语言。</p>
<ol>
<li>string转int<br><code>php</code>在将<code>string</code>转化成<code>int</code>的时候会把后面的字母舍掉。<br>比如 ‘132a’会被转化为123。又比如’aaa‘会被转化为为0。<br>受到影响的:<code>intval()</code>,<code>==</code>,<code>&gt;</code>,’<code>&lt;</code>等。看到具体的例子。<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">is_numeric(@$a[&quot;str&quot;])?die(&quot;eroor&quot;):NULL;</span><br><span class="line">    if(@$a[&quot;str&quot;])&#123;</span><br><span class="line">       if ($a[&quot;str&quot;]&gt;2016)&#123;</span><br><span class="line">       echo $flag;</span><br><span class="line">    &#125;</span><br><span class="line">   &#125;</span><br></pre></td></tr></table></figure>
</li>
</ol>
<p>这时只需要传入2017aaa就可以绕过</p>
<ol>
<li>进制转化<br>会自动转化进制，而且支持科学计数法<br><code>var_dump(0x10==16);
var_dump(020==16);
var_dump(2e1==20);</code><br>这些都是正确的，举个例子<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">?php</span><br><span class="line">$md51 = md5(&apos;QNKCDZO&apos;);</span><br><span class="line">$a = @$_GET[&apos;a&apos;];</span><br><span class="line">$md52 = @md5($a);</span><br><span class="line">if(isset($a))&#123;</span><br><span class="line">if ($a != &apos;QNKCDZO&apos; &amp;&amp; $md51 == $md52) &#123;</span><br><span class="line">    echo &quot;nctf&#123;*****************&#125;&quot;;</span><br><span class="line">&#125; else &#123;</span><br><span class="line">    echo &quot;false!!!&quot;;</span><br><span class="line">&#125;&#125;</span><br><span class="line">else&#123;echo &quot;please input a&quot;;&#125;</span><br><span class="line">?&gt;</span><br></pre></td></tr></table></figure>
</li>
</ol>
<p>这时只要找出两个数的md5都是0e开头的就可以。<br>具体哪些，看这一篇<a href="http://www.cnblogs.com/Primzahl/p/6018158.html" target="_blank" rel="noopener">PHP处理0e开头md5哈希字符串缺陷/bug</a><br><a id="more"></a></p>
<h1 id="0x01-strcmp"><a href="#0x01-strcmp" class="headerlink" title="0x01 strcmp"></a>0x01 strcmp</h1><p>strcmp(array,string)=null=0<br>具体例子<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">&lt;?php</span><br><span class="line">$pass=@$_POST[&apos;pass&apos;];</span><br><span class="line">$pass1=***********;//被隐藏起来的密码</span><br><span class="line">if(isset($pass))</span><br><span class="line">&#123;</span><br><span class="line">    if(@!strcmp($pass,$pass1))&#123;</span><br><span class="line">    echo &quot;flag:nctf&#123;*&#125;&quot;;</span><br><span class="line">  &#125;else&#123;</span><br><span class="line">  echo &quot;the pass is wrong!&quot;;</span><br><span class="line">&#125;</span><br><span class="line">&#125;else&#123;</span><br><span class="line">  echo &quot;please input pass!&quot;;</span><br><span class="line">&#125;</span><br><span class="line">?&gt;</span><br></pre></td></tr></table></figure></p>
<p>传进一个数组就行</p>
<h1 id="0x02-array-search-与in-array"><a href="#0x02-array-search-与in-array" class="headerlink" title="0x02 array_search()与in_array()"></a>0x02 array_search()与in_array()</h1><p>传进的string被转化为0的情况<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">$array=array(13);</span><br><span class="line">var_dump(strcmp($array,&apos;abc&apos;)==true );</span><br></pre></td></tr></table></figure></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">$array=array(0=&gt;&apos;a&apos;,&apos;b&apos;);</span><br><span class="line">var_dump(array_search(&apos;b&apos;,$array) == false ); //false</span><br><span class="line">var_dump(array_search(&apos;c&apos;,$array) == false ); //true</span><br><span class="line">var_dump(array_search(&apos;a&apos;,$array) == false ); //true  特例，刚好找到是0 0==flase</span><br></pre></td></tr></table></figure>
<h1 id="0x03-md5"><a href="#0x03-md5" class="headerlink" title="0x03 md5"></a>0x03 md5</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">$array=array(0=&gt;&apos;a&apos;,&apos;b&apos;);</span><br><span class="line">$b=array(0);</span><br><span class="line">var_dump(md5($array)===md5($b)); //true</span><br></pre></td></tr></table></figure>
<p>两个数组的md5一样</p>
<h1 id="0x04-eregi"><a href="#0x04-eregi" class="headerlink" title="0x04 eregi"></a>0x04 eregi</h1><p>可以被截断<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">$c=@$_GET[&apos;cat&apos;];</span><br><span class="line">$d=@$_GET[&apos;dog&apos;];</span><br><span class="line">if(@$c[1])&#123;</span><br><span class="line">    if(!strcmp($c[1],$d) &amp;&amp; $c[1]!==$d)&#123;</span><br><span class="line">		</span><br><span class="line">        eregi(&quot;3|1|c&quot;,$d.$c[0])?die(&quot;nope&quot;):NULL;</span><br><span class="line">        strpos(($c[0].$d), &quot;isccctf2017&quot;)?$v3=1:NULL;</span><br><span class="line">		</span><br><span class="line">    &#125;</span><br></pre></td></tr></table></figure></p>
<p>构造截断就好</p>
<h1 id="0x05-file-put-content和unlink"><a href="#0x05-file-put-content和unlink" class="headerlink" title="0x05 file_put_content和unlink"></a>0x05 file_put_content和unlink</h1><h1 id="0x06-rand"><a href="#0x06-rand" class="headerlink" title="0x06 rand"></a>0x06 rand</h1><h1 id="0x07-end-array-和array-length-array-1"><a href="#0x07-end-array-和array-length-array-1" class="headerlink" title="0x07 end(array)和array[length(array)-1]"></a>0x07 end(array)和array[length(array)-1]</h1><h1 id="0x08-未初始化变量漏洞"><a href="#0x08-未初始化变量漏洞" class="headerlink" title="0x08 未初始化变量漏洞"></a>0x08 未初始化变量漏洞</h1>  
	</div>
		<footer class="article-footer clearfix">
<div class="article-catetags">

<div class="article-categories">
  <span></span>
  <a class="article-category-link" href="/categories/ctf/">ctf</a>
</div>


  <div class="article-tags">
  
  <span></span> <a href="/tags/ctf/">ctf</a><a href="/tags/Web/">Web</a><a href="/tags/代码审计/">代码审计</a>
  </div>

</div>



	<div class="article-share" id="share">
	
	  <div data-url="http://www.daiker.com.cn/2017/05/04/CTF中代码审计小trick(未完)/" data-title="CTF中代码审计小trick(未完) | " data-tsina="5688081717" class="share clearfix">
	  </div>
	
	</div>


</footer>

   	       
	</article>
	
<nav class="article-nav clearfix">
 
 <div class="prev" >
 <a href="/2017/05/09/insert 注入/" title="insert 注入">
  <strong>上一篇：</strong><br/>
  <span>
  insert 注入</span>
</a>
</div>


<div class="next">
<a href="/2017/04/28/一次简单渗透/"  title="一次简单渗透">
 <strong>下一篇：</strong><br/> 
 <span>一次简单渗透
</span>
</a>
</div>

</nav>

	
<section id="comments" class="comment">
	<div class="ds-thread" data-thread-key="2017/05/04/CTF中代码审计小trick(未完)/" data-title="CTF中代码审计小trick(未完)" data-url="http://www.daiker.com.cn/2017/05/04/CTF中代码审计小trick(未完)/"></div>
</section>




</div>  
      <div class="openaside"><a class="navbutton" href="#" title="Show Sidebar"></a></div>

  <div id="toc" class="toc-aside">
  <strong class="toc-title">Contents</strong>
 
 <ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#0x00-弱类型"><span class="toc-number">1.</span> <span class="toc-text"><a href="#0x00-&#x5F31;&#x7C7B;&#x578B;" class="headerlink" title="0x00 &#x5F31;&#x7C7B;&#x578B;"></a>0x00 &#x5F31;&#x7C7B;&#x578B;</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#0x01-strcmp"><span class="toc-number">2.</span> <span class="toc-text"><a href="#0x01-strcmp" class="headerlink" title="0x01 strcmp"></a>0x01 strcmp</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#0x02-array-search-与in-array"><span class="toc-number">3.</span> <span class="toc-text"><a href="#0x02-array-search-&#x4E0E;in-array" class="headerlink" title="0x02 array_search()&#x4E0E;in_array()"></a>0x02 array_search()&#x4E0E;in_array()</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#0x03-md5"><span class="toc-number">4.</span> <span class="toc-text"><a href="#0x03-md5" class="headerlink" title="0x03 md5"></a>0x03 md5</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#0x04-eregi"><span class="toc-number">5.</span> <span class="toc-text"><a href="#0x04-eregi" class="headerlink" title="0x04 eregi"></a>0x04 eregi</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#0x05-file-put-content和unlink"><span class="toc-number">6.</span> <span class="toc-text"><a href="#0x05-file-put-content&#x548C;unlink" class="headerlink" title="0x05 file_put_content&#x548C;unlink"></a>0x05 file_put_content&#x548C;unlink</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#0x06-rand"><span class="toc-number">7.</span> <span class="toc-text"><a href="#0x06-rand" class="headerlink" title="0x06 rand"></a>0x06 rand</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#0x07-end-array-和array-length-array-1"><span class="toc-number">8.</span> <span class="toc-text"><a href="#0x07-end-array-&#x548C;array-length-array-1" class="headerlink" title="0x07 end(array)&#x548C;array[length(array)-1]"></a>0x07 end(array)&#x548C;array[length(array)-1]</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#0x08-未初始化变量漏洞"><span class="toc-number">9.</span> <span class="toc-text"><a href="#0x08-&#x672A;&#x521D;&#x59CB;&#x5316;&#x53D8;&#x91CF;&#x6F0F;&#x6D1E;" class="headerlink" title="0x08 &#x672A;&#x521D;&#x59CB;&#x5316;&#x53D8;&#x91CF;&#x6F0F;&#x6D1E;"></a>0x08 &#x672A;&#x521D;&#x59CB;&#x5316;&#x53D8;&#x91CF;&#x6F0F;&#x6D1E;</span></a></li></ol>
 
  </div>

<div id="asidepart">
<div class="closeaside"><a class="closebutton" href="#" title="Hide Sidebar"></a></div>
<aside class="clearfix">

  
<div class="github-card">
<p class="asidetitle">Github Card</p>
<div class="github-card" data-github="daikersec" data-theme="medium"></div>
<script type="text/javascript" src="//cdn.jsdelivr.net/github-cards/latest/widget.js" ></script>
</div>



  
<div class="categorieslist">
	<p class="asidetitle">Categories</p>
		<ul>
		
		  
			<li><a href="/categories/ctf/" title="ctf">ctf<sup>5</sup></a></li>
		  
		
		  
			<li><a href="/categories/注入/" title="注入">注入<sup>1</sup></a></li>
		  
		
		  
			<li><a href="/categories/渗透测试/" title="渗透测试">渗透测试<sup>1</sup></a></li>
		  
		
		  
			<li><a href="/categories/漏洞研究/" title="漏洞研究">漏洞研究<sup>1</sup></a></li>
		  
		
		</ul>
</div>


  
<div class="tagslist">
	<p class="asidetitle">Tags</p>
		<ul class="clearfix">
		
			
				<li><a href="/tags/Web/" title="Web">Web<sup>8</sup></a></li>
			
		
			
				<li><a href="/tags/ctf/" title="ctf">ctf<sup>6</sup></a></li>
			
		
			
				<li><a href="/tags/hackinglab/" title="hackinglab">hackinglab<sup>2</sup></a></li>
			
		
			
				<li><a href="/tags/漏洞研究/" title="漏洞研究">漏洞研究<sup>2</sup></a></li>
			
		
			
				<li><a href="/tags/代码审计/" title="代码审计">代码审计<sup>1</sup></a></li>
			
		
			
				<li><a href="/tags/php/" title="php">php<sup>1</sup></a></li>
			
		
			
				<li><a href="/tags/注入/" title="注入">注入<sup>1</sup></a></li>
			
		
			
				<li><a href="/tags/渗透/" title="渗透">渗透<sup>1</sup></a></li>
			
		
			
				<li><a href="/tags/提权/" title="提权">提权<sup>1</sup></a></li>
			
		
		</ul>
</div>


  
  <div class="archiveslist">
    <p class="asidetitle"><a href="/archives">Archives</a></p>
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/02/">February 2018</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/12/">December 2017</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/07/">July 2017</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/05/">May 2017</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/04/">April 2017</a><span class="archive-list-count">3</span></li></ul>
  </div>


  <div class="rsspart">
	<a href="/atom.xml" target="_blank" title="rss">RSS</a>
</div>

</aside>
</div>
    </div>
    <footer><div id="footer" >
	
	<div class="line">
		<span></span>
		<div class="author"></div>
	</div>
	
	
	<div class="social-font" class="clearfix">
		
		<a href="http://weibo.com/daikersec" target="_blank" class="icon-weibo" title="微博"></a>
		
		
		<a href="https://github.com/daikersec" target="_blank" class="icon-github" title="github"></a>
		
		
		
		<a href="https://twitter.com/daikersec" target="_blank" class="icon-twitter" title="twitter"></a>
		
		
		
		
		
		
		
		<a href="mailto:daikersec@gmail.com" target="_blank" class="icon-email" title="Email Me"></a>
		
	</div>
			
		

		<p class="copyright">
		Powered by <a href="http://hexo.io" target="_blank" title="hexo">hexo</a> and Theme by <a href="https://github.com/wuchong/jacman" target="_blank" title="Jacman">Jacman</a> © 2018 
		
		<a href="/about" target="_blank" title="daiker">daiker</a>
		
		
		</p>
</div>
</footer>
    <script src="/js/jquery-2.0.3.min.js"></script>
<script src="/js/jquery.imagesloaded.min.js"></script>
<script src="/js/gallery.js"></script>
<script src="/js/jquery.qrcode-0.12.0.min.js"></script>

<script type="text/javascript">
$(document).ready(function(){ 
  $('.navbar').click(function(){
    $('header nav').toggleClass('shownav');
  });
  var myWidth = 0;
  function getSize(){
    if( typeof( window.innerWidth ) == 'number' ) {
      myWidth = window.innerWidth;
    } else if( document.documentElement && document.documentElement.clientWidth) {
      myWidth = document.documentElement.clientWidth;
    };
  };
  var m = $('#main'),
      a = $('#asidepart'),
      c = $('.closeaside'),
      o = $('.openaside');
  c.click(function(){
    a.addClass('fadeOut').css('display', 'none');
    o.css('display', 'block').addClass('fadeIn');
    m.addClass('moveMain');
  });
  o.click(function(){
    o.css('display', 'none').removeClass('beforeFadeIn');
    a.css('display', 'block').removeClass('fadeOut').addClass('fadeIn');      
    m.removeClass('moveMain');
  });
  $(window).scroll(function(){
    o.css("top",Math.max(80,260-$(this).scrollTop()));
  });
  
  $(window).resize(function(){
    getSize(); 
    if (myWidth >= 1024) {
      $('header nav').removeClass('shownav');
    }else{
      m.removeClass('moveMain');
      a.css('display', 'block').removeClass('fadeOut');
      o.css('display', 'none');
      
      $('#toc.toc-aside').css('display', 'none');
        
    }
  });
});
</script>

<script type="text/javascript">
$(document).ready(function(){ 
  var ai = $('.article-content>iframe'),
      ae = $('.article-content>embed'),
      t  = $('#toc'),
      ta = $('#toc.toc-aside'),
      o  = $('.openaside'),
      c  = $('.closeaside');
  if(ai.length>0){
    ai.wrap('<div class="video-container" />');
  };
  if(ae.length>0){
   ae.wrap('<div class="video-container" />');
  };
  c.click(function(){
    ta.css('display', 'block').addClass('fadeIn');
  });
  o.click(function(){
    ta.css('display', 'none');
  });
  $(window).scroll(function(){
    ta.css("top",Math.max(140,320-$(this).scrollTop()));
  });
});
</script>


<script type="text/javascript">
$(document).ready(function(){ 
  var $this = $('.share'),
      url = $this.attr('data-url'),
      encodedUrl = encodeURIComponent(url),
      title = $this.attr('data-title'),
      tsina = $this.attr('data-tsina'),
      description = $this.attr('description');
  var html = [
  '<div class="hoverqrcode clearfix"></div>',
  '<a class="overlay" id="qrcode"></a>',
  '<a href="https://www.facebook.com/sharer.php?u=' + encodedUrl + '" class="article-share-facebook" target="_blank" title="Facebook"></a>',
  '<a href="https://twitter.com/intent/tweet?url=' + encodedUrl + '" class="article-share-twitter" target="_blank" title="Twitter"></a>',
  '<a href="#qrcode" class="article-share-qrcode" title="微信"></a>',
  '<a href="http://widget.renren.com/dialog/share?resourceUrl=' + encodedUrl + '&srcUrl=' + encodedUrl + '&title=' + title +'" class="article-share-renren" target="_blank" title="人人"></a>',
  '<a href="http://service.weibo.com/share/share.php?title='+title+'&url='+encodedUrl +'&ralateUid='+ tsina +'&searchPic=true&style=number' +'" class="article-share-weibo" target="_blank" title="微博"></a>',
  '<span title="Share to"></span>'
  ].join('');
  $this.append(html);

  $('.hoverqrcode').hide();

  var myWidth = 0;
  function updatehoverqrcode(){
    if( typeof( window.innerWidth ) == 'number' ) {
      myWidth = window.innerWidth;
    } else if( document.documentElement && document.documentElement.clientWidth) {
      myWidth = document.documentElement.clientWidth;
    };
    var qrsize = myWidth > 1024 ? 200:100;
    var options = {render: 'image', size: qrsize, fill: '#2ca6cb', text: url, radius: 0.5, quiet: 1};
    var p = $('.article-share-qrcode').position();
    $('.hoverqrcode').empty().css('width', qrsize).css('height', qrsize)
                          .css('left', p.left-qrsize/2+20).css('top', p.top-qrsize-10)
                          .qrcode(options);
  };
  $(window).resize(function(){
    $('.hoverqrcode').hide();
  });
  $('.article-share-qrcode').click(function(){
    updatehoverqrcode();
    $('.hoverqrcode').toggle();
  });
  $('.article-share-qrcode').hover(function(){}, function(){
      $('.hoverqrcode').hide();
  });
});   
</script>



<script type="text/javascript">
  var duoshuoQuery = {short_name:"嘟嘟MD"};
  (function() {
    var ds = document.createElement('script');
    ds.type = 'text/javascript';ds.async = true;
    ds.src = '//static.duoshuo.com/embed.js';
    ds.charset = 'UTF-8';
    (document.getElementsByTagName('head')[0] 
    || document.getElementsByTagName('body')[0]).appendChild(ds);
  })();
</script> 









<link rel="stylesheet" href="/fancybox/jquery.fancybox.css" media="screen" type="text/css">
<script src="/fancybox/jquery.fancybox.pack.js"></script>
<script type="text/javascript">
$(document).ready(function(){ 
  $('.article-content').each(function(i){
    $(this).find('img').each(function(){
      if ($(this).parent().hasClass('fancybox')) return;
      var alt = this.alt;
      if (alt) $(this).after('<span class="caption">' + alt + '</span>');
      $(this).wrap('<a href="' + this.src + '" title="' + alt + '" class="fancybox"></a>');
    });
    $(this).find('.fancybox').each(function(){
      $(this).attr('rel', 'article' + i);
    });
  });
  if($.fancybox){
    $('.fancybox').fancybox();
  }
}); 
</script>



<!-- Analytics Begin -->



<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "//hm.baidu.com/hm.js?2a1c7e2856fa901812e41edbfcef616e";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>



<!-- Analytics End -->

<!-- Totop Begin -->

	<div id="totop">
	<a title="Back to Top"><img src="/img/scrollup.png"/></a>
	</div>
	<script src="/js/totop.js"></script>

<!-- Totop End -->

<!-- MathJax Begin -->
<!-- mathjax config similar to math.stackexchange -->

<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    tex2jax: {
      inlineMath: [ ['$','$'], ["\\(","\\)"] ],
      processEscapes: true
    }
  });
</script>

<script type="text/x-mathjax-config">
    MathJax.Hub.Config({
      tex2jax: {
        skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
      }
    });
</script>

<script type="text/x-mathjax-config">
    MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for(i=0; i < all.length; i += 1) {
            all[i].SourceElement().parentNode.className += ' has-jax';
        }
    });
</script>

<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>


<!-- MathJax End -->

<!-- Tiny_search Begin -->

<!-- Tiny_search End -->

  </body>
</html>
